<template>
  <!-- 内容区域 -->
  <div class="content-wrapper">

    <!-- 内容头部 -->
    <section class="content-header">
      <h1>
        货架管理
        <small>管理您仓库中的货架</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-university"></i> 货架管理</a></li>
        <li><a href="#"> 货架详情</a></li>
        <li class="active">修改货架</li>
      </ol>
    </section>
    <!-- 内容头部 /-->

    <!-- 正文区域 -->
    <section class="content">
      <!-- 修改密码 -->
      <div class="box box-primary">
        <div class="box-header with-border">
          <h3 class="box-title">修改货架</h3>
        </div>
        <!-- /.box-header -->
        <!-- form start -->
        <form role="form">
          <div class="box-body">
            <div class="form-group">
              <label for="rackId">货架Id</label>
              <input id="rackId" :value="rack.id" class="form-control" data-cip-id="rackId" disabled placeholder="货架Id"
                     type="text">
            </div>
            <div class="form-group">
              <label for="rackName">名称</label>
              <input id="rackName" :value="rack.name" class="form-control" data-cip-id="rackName" placeholder="名称"
                     type="text">
            </div>
            <div>
              <p id="message" class="alert alert-danger hidden">message</p>
            </div>
          </div>
          <!-- /.box-body -->
          <div class="box-footer">
            <button class="btn btn-primary" type="button" @click="change">提交修改</button>
          </div>
        </form>
      </div>
      <!-- /.row -->
    </section>
    <!-- 正文区域 /-->

  </div>
  <!-- 内容区域 /-->
</template>

<script>
export default {
  name: "ChangeRack",
  data() {
    return {
      rack: this.GLOBAL.appData.rackList[this.$route.params.id - 1]
    }
  },
  methods: {
    change() {
      let rackName = document.getElementById("rackName");
      if (rackName.value === "") {
        this.$message.warning("货架名不得为空");
      } else {
        this.GLOBAL.appData.rackList[this.$route.params.id - 1].name = rackName.value;
        this.$router.push("/main/rackData");
      }
    }
  }
}
</script>

<style scoped>

</style>